<?php


    require_once('../SiteIncludes.GLOBAL.php');
    
    if(EclipseMDE::runningOnMod_Rewrite() === false) {
	// Security Guard, Do Not Let This be accessed by any other means than mod_rewrite
	$gVAR['e'] = '404';
	require_once('error_handler.php');
	die();
    }
    
    // Add Javascript for cleanup script and confirmer script
    $TemplateEngine->add_postloadScript('<script type="text/javascript" src="/js/ajaxCleanup.js"></script>');
    $TemplateEngine->add_postloadScript('<script type="text/javascript" src="/js/ajaxConfirmer.js"></script>');
    $TemplateEngine->add_postloadScript('<script type="text/javascript" src="/js/EMDE.js"></script>');
    $TemplateEngine->add_postloadScript('<script type="text/javascript" src="/js/ToolTip.js"></script>');
    
    /**
     * This is the switch that handles the difference between admin and user searches.
     * It is set in www-admin/user.php, and if it is not set, it is set to false here.
     * This is how the script decides if you are an admin searcher or not. 
     */
    if(isset($_ADMINSEARCH) === false) {
	$_ADMINSEARCH = false;
    }
    
    // Ensure all variables needed are set
    if(isset($_LOGGEDINUSER) === true && $_LOGGEDINUSER !== false) {
        $TemplateEngine->create_content_html($Templater->user_searchbox($_ADMINSEARCH));
        // Hide sidebar
        $TemplateEngine->setHasSidebar(false);
        $TemplateEngine->setCentralContentFullWidth(true);
        $TemplateEngine->render();
    } else {
        $gVAR['e'] = 404;
        require_once('error_handler.php');
    }
?>
